package com.wzcl.app.model.vo;

import com.wzcl.app.dao.model.Activity;
import com.wzcl.app.model.common.WZCL;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.Map;

@EqualsAndHashCode(callSuper = false)
@Data
public class ActivityVo extends BaseVo{
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "类型名称")
    private String name;

    @ApiModelProperty(value = "活动类型")
    private Integer type;
    private String typeStr;

    @ApiModelProperty(value = "开始时间")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    private Date endTime;

    @ApiModelProperty(value = "活动地址")
    private String activityUrl;

    @ApiModelProperty(value = "排序字段")
    private Integer orderNo;

    @ApiModelProperty(value = "活动作用范围")
    private Integer scope;
    private String scopeStr;

    @ApiModelProperty(value = "活动状态")
    private Integer activityState;
    private String activityStateStr;

    private ActivityVo(){
    }

    public static ActivityVo create(Activity activity){
        ActivityVo activityVo = new ActivityVo();
        BeanUtils.copyProperties(activity,activityVo);
        activityVo.translationValueStr();
        return activityVo;
    }

    @Override
    public void translationValueStr() {
        Map<String, Map<Integer, String>> map = getTranslationMap();
        this.typeStr=map.get(WZCL.GROUP_NAME.ACTIVITY_TYPE).get(this.type);
        this.activityStateStr=map.get(WZCL.GROUP_NAME.ACTIVITY_STATE).get(this.activityState);
        this.scopeStr=map.get(WZCL.GROUP_NAME.ACTIVITY_SCOPE).get(this.scope);
    }

    @Override
    public void processResources() {

    }
}
